import { useUsersStore } from '@/stores/user'
import { storeToRefs } from 'pinia'
const store = useUsersStore()
const {rnsc} = storeToRefs(store)
export const clip=function({result,clipSuccess}){
  var clspath = result.results[0].Value
  var resultNamecli =
    'gdbp://MapGisLocal/wuhan/ds/clip/sfcls/clipresult' + Date.now()
   store.rnsc=resultNamecli
  //实例化ClipByLayer类
  var clipParam = new Zondy.Service.ClipByLayer({
    ip: 'localhost',
    port: 6163,
    //源简单要素类的URL
    srcInfo1: 'gdbp://MapGisLocal/wuhan/sfcls/居民区',
    //裁剪框简单要素类的URL
    srcInfo2: clspath,
    //设置结果URL
    desInfo: resultNamecli,
    infoOptType: 0,
  })
  //调用基类的execute方法，执行图层裁剪分析。AnalysisSuccess为结果回调函数
  clipParam.execute(clipSuccess, 'post', false, 'json', clipError)
  function clipError() {
    console.log('裁剪失败')
  }
}